<?php

namespace App\Http\Controllers;

use App\AboutModel;
use App\ImageModel;
use App\NewsModel;
use App\ProModel;
use Illuminate\Http\Request;

class PageController extends Controller
{
    //
    public function index()
    {
        $swiper_img_list = ImageModel::swiper_img_list();
        $about_msg = AboutModel::about_us_msg();

        $about_image = AboutModel::about_us_image();
        $new_get = NewsModel::get();
        return view('page.index', [
            'news' => $new_get,
            'swiper_img_list' => $swiper_img_list,
            'about_image' => $about_image,
            'about_texts' => $about_msg
        ]);
    }

    public function index5($id)
    {
        $swiper_img_list = ImageModel::swiper_img_list();
        $about_msg = AboutModel::about_us_msg();

        $about_image = AboutModel::about_us_image();
        return view('page.index', [
            'swiper_img_list' => $swiper_img_list,
            'about_image' => $about_image,
            'about_texts' => $about_msg,
            'page' => $id
        ]);
    }

    // about关于页面
    public function about()
    {
        $about_us = AboutModel::about_us_list();

        $about_image = AboutModel::about_us_image();

        $about_msg = AboutModel::about_us_msg();

        return view('page.about', [
            'about_us' => $about_us,
            'about_image' => $about_image,
            'about_texts' => $about_msg
        ]);
    }

    // 资讯页面
    public function news()
    {
        $about_msg = AboutModel::about_us_msg();
        $news_list = NewsModel::get();
        return view('page.news', [
            'about_texts' => $about_msg,
            'news_list' => $news_list
        ]);
    }

    // 产品详情页面
    public function pro()
    {
        $about_msg = AboutModel::about_us_msg();
        $get_item = ProModel::get_item();
        $get_all_alone = ProModel::get_alone();
        $get_all_image = ProModel::get_img();
        return view('page.pro', [
            'about_texts' => $about_msg,
            'get_item' => $get_item,
            'get_all_alone' => $get_all_alone,
            'get_all_image' => $get_all_image
        ]);
    }
}
